/**
* @author: LiYaHui
* @date: 2021-11-02
* @description: 预警相关接口
*/
import axios from '@/libs/api.request'

/**
 * 获取预警统计
 * @param params
 */
export const getStatistics = params => axios.request({
  url: '/api/Statistics',
  method: 'get',
  params
})

/**
 * 获取所有预警列表
 */
export const getAlarmList = params => axios.request({
  url: '/api/Alarm',
  params,
  method: 'get'
})

/**
 * 快速检索分页查询
 * @param params
 * @returns {*}
 */
export const getQuckSearchPage = params => axios.request({
  url: '/api/Alarm/quckSearchPage',
  method: 'get',
  params
})

/**
 * 快速检索不带分页
 * @param params
 * @returns {*}
 */
export const getQuckSearch = params => axios.request({
  url: '/api/Alarm/quckSearch',
  method: 'get',
  params
})

/**
 * 高级检索
 * @param params
 */
export const xx = params => axios.request({
  url: 'api/Alarms/quckSearch',
  params,
  method: 'get'
})

/**
 * 获取预警等级
 */
export const getAlarmLevel = () => axios.request({
  url: '/api/Alarm/AlarmLevel',
  method: 'get'
})

/**
 * 获取预警类型
 */
export const getAlarmType = () => axios.request({
  url: '/api/Alarm/AlarmType',
  method: 'get'
})

/**
 * 获取区域
 */
export const getLocations = () => axios.request({
  url: '/api/Locations',
  method: 'get'
})

/**
 * 根据区域获取摄像头
 * @param id
 */
export const getLocationsVideo = id => axios.request({
  url: `/api/Videos/location/?locationID=${id}`,
  method: 'get'
})

/**
 * 获取预警闪屏信息
 * @param time
 * @returns {*}
 */
export const getWarning = time => axios.request({
  url: `/api/Alarm/Warning?time=${time}`,
  method: 'get'
})

/**
 * 获取所有摄像头信息
 * @returns {*}
 */
export const getAllVideos = () => axios.request({
  url: '/api/Videos',
  method: 'get'
})

/**
 * 获取预警状态
 * @returns {*}
 */
export const getAlarmStateDef = () => axios.request({
  url: '/api/Alarm/AlarmStateDef',
  method: 'get'
})

/**
 * 获取所有预警项
 * @returns {*}
 */
export const getAlgorithmType = () => axios.request({
  url: '/api/Services/AlgorithmType',
  method: 'get'
})

// 获取所有预警项
export const getAll = () => axios.request({
  url: '/api/Algos/GetAll',
  method: 'get'
})

/**
 * 获取详情？
 * @param id
 * @returns {*}
 */
export const getAlarmInfo = id => axios.request({
  url: `/api/Alarm/${id}`,
  method: 'get'
})

/**
 * 预警核验
 * @param params
 */
export const setState = params => axios.request({
  url: '/api/Alarm/state',
  method: 'post',
  params
})

/**
 * 预警项查询-分页
 * @param params
 * @returns {*}
 */
export const getPageAlgo = params => axios.request({
  url: '/api/Algos/PageAlgo',
  method: 'get',
  params
})

/**
 * 预警项查询-全部
 * @param params
 * @returns {*}
 */
export const getAlgos = params => axios.request({
  url: '/api/Algos',
  method: 'get',
  params
})

/**
 * 预警项修改
 * @param data
 * @returns {*}
 * @constructor
 */
export const ChangeAvality = data => axios.request({
  url: '/api/Algos/ChangeAvality',
  method: 'post',
  data
})
